<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>
<body>
    <script src="/Users/yuu/Documents/workspace/codes/chongqing4/biz/node_modules/moment/min/moment.min.js"></script>
    <script>

        console.log(moment);

        // Date
        // 获取当前的时间戳
        // 1970 1.1  00:00:00 000ms 到当前时间的毫秒数
        // 毫秒级时间戳
        console.log(Date.now()); //

        // var msg = {
        //     from: '张三',
        //     to: '李四',
        //     content: '今晚开黑？',
        //     timestamp: 1639815857936,
        // };

        // console.log(Math.floor(Date.now() / 1000)) // 1639815857.936  >>>  1639815857

        // 获取当前年份 2021
        // var date = new Date(); // 实例 instance
        // console.log(date.getFullYear());
        // console.log(date.getMonth()); // 0 - 11
        // console.log(date.getDay()); // 星期6

        // http://momentjs.cn/
        console.log(moment(1639815857936).format('YYYY')); // 2021
        console.log(moment(1639815857936).format('MM')); // 12
        console.log(moment(1639815857936).format('DD')); // 18
        console.log(moment(1639815857936).format('YYYY.MM.DD')); //
        console.log(moment(1639815857936).format('YYYY-MM-DD')); //
        console.log(moment(1639815857936).format('YYYY***MM***DD')); //
        console.log(moment(1639815857936).format('YYYY.MM.DD HH:mm:ss')); //


    </script>
</body>
</html>